package cn.iocoder.yudao.module.infrastructure.wechat.dao;

import cn.iocoder.yudao.framework.business.basic.dao.mapper.CoreMapper;
import cn.iocoder.yudao.framework.business.basic.dao.query.CoreLambdaQueryWrapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infrastructure.wechat.pojo.po.WechatTemplate;
import cn.iocoder.yudao.module.infrastructure.wechat.pojo.vo.WechatTemplatePageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 微信消息模板 Mapper
 *
 * @author yshop
 * @author 山野羡民
 */
@Mapper
public interface WechatTemplateMapper extends CoreMapper<WechatTemplate> {

    default PageResult<WechatTemplate> selectPage(WechatTemplatePageReqVO reqVO) {
        return selectPage(reqVO, new CoreLambdaQueryWrapper<WechatTemplate>()
                .eqIfPresent(WechatTemplate::getTempkey, reqVO.getTempkey())
                .likeIfPresent(WechatTemplate::getName, reqVO.getName())
                .eqIfPresent(WechatTemplate::getContent, reqVO.getContent())
                .eqIfPresent(WechatTemplate::getTempid, reqVO.getTempid())
                .betweenIfPresent(WechatTemplate::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(WechatTemplate::getStatus, reqVO.getStatus())
                .eqIfPresent(WechatTemplate::getType, reqVO.getType())
                .orderByAsc(WechatTemplate::getType)
                .orderByDesc(WechatTemplate::getId));
    }

}
